package com.example.gybicycle.service;

import com.example.gybicycle.common.entity.Result;
import com.example.gybicycle.common.enums.NumType;
import com.example.gybicycle.common.sql.CrudService;
import com.example.gybicycle.common.util.DataUtil;
import com.example.gybicycle.common.util.NumberUtil;
import com.example.gybicycle.dao.MemberCyclingDao;
import com.example.gybicycle.entity.MemberCycling;
import com.example.gybicycle.entity.MemberPay;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class MemberCyclingService extends CrudService<MemberCyclingDao, MemberCycling> {
    @Override
    public MemberCycling get(String id) {
        MemberCycling table=super.get(id);
        return table;
    }
    public List<MemberCycling> findList(MemberCycling entity){
        List<MemberCycling> list=super.findList(entity);
        for(MemberCycling cycling:list){
            cycling.setDuration(setDuration(cycling));
        }
        return list;
    }
public static String setDuration(MemberCycling cycling){
        if(cycling.getDuration()==null||cycling.getDuration().length()==0)
            return "";
        String[] strs=cycling.getDuration().split(":");
        if(strs.length==1)
            return cycling.getDuration()+"秒";
        if(strs.length==2)
            return strs[0]+"分"+strs[1]+"秒";
        if(strs.length==3)
            return strs[0]+"时"+strs[1]+"分"+strs[2]+"秒";
        return cycling.getDuration();

}



}